package com.fmatos.service.album.downloader.info;

import com.fmatos.service.album.downloader.ImageDownloader;
import com.fmatos.service.album.downloader.rss.AbstractRssDownloader;
import com.fmatos.service.album.downloader.rss.PinterestRssDownloader;


public class PinterestAlbumInfo extends AlbumInfo {

	private String board;
	private String user;

	public PinterestAlbumInfo(String niceName, String user, String board) {	
		super(buildName(user,board), niceName, buildUrl(user,board));
		this.user = user;
		this.board = board;
	}

	public PinterestAlbumInfo(String niceName, String user) {
		super(buildName(user,null), niceName, buildUrl(user,null));
		this.user = user;
		this.board = null;
	}
	
	private static String buildName(String user, String board) {
		return "pinterest-"+user+ "-" + board;
	}

	public static String buildUrl(String userName, String boardName) {

		String url = "http://www.pinterest.com/";
		url += userName;
		
		if ( boardName != null && ! boardName.isEmpty()) {
			url += "/" + boardName;
		}
		
		return url;
}

	@Override
	public ImageDownloader getDownloader() {
		PinterestRssDownloader downloader =  new PinterestRssDownloader(user, board);

		return downloader;
	}



}
